package com.burgeon.backend.Controller;

import com.burgeon.backend.service.ViewService;
import com.burgeon.backend.stsutil.ResponseResult;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@CrossOrigin
@RestController
@RequestMapping("view")
public class ViewController extends BaseController {

    @Autowired
    private ViewService viewService;


    @RequestMapping("getShopView")
    public ResponseResult<Map> getShopView(String account){

        System.err.println(account);
        Map data = viewService.getShopView(account);
        System.err.println(data);

        return new ResponseResult<Map>(SUCCESS,data);
    }

    @RequestMapping("retail")
    public ResponseResult<Map> GetRetaiViewData(String account){
       // String account = session.getAttribute("account").toString();
        System.err.println(account);
        Map data = viewService.GetRetailMap(account);
        System.err.println(data);

        return new ResponseResult<Map>(SUCCESS,data);
    }
    @RequestMapping("vip")
    public ResponseResult<List> GetVIPViewData(String account){

        List data = viewService.GetVIPViewList(account);


        return new ResponseResult<List>(SUCCESS,data);
    }

    @RequestMapping("mainview")
    public ResponseResult<Map> MainViewData(String account){
        //String account = session.getAttribute("account").toString();
        Map data = viewService.MainView(account);

        return new ResponseResult<Map>(SUCCESS,data);
    }


}
